﻿using UnityEngine;

namespace Core
{
    public class SystemContext : AbstractGameContext
    {
        public AssemblySystem Assembly { get; private set; }
        public SettingSystem Setting { get; private set; }
        public PlatformSystem Platform { get; private set; }
        // public VariantSystem Variant { get; private set; }
        public FileSystem File { get; private set; }
        public TimerSystem Timer { get; private set; }

        public void Awake(MonoBehaviour mono)
        {
            this.mono = mono;
            gameObject = mono.gameObject;

            InstanceId = Utils.ID.Get();
            SetSG(Context.Sys, this);
            Name = "s_common";

            Assembly = Acquire<AssemblySystem>();
            Assembly.Awake();
        }

        public override void AddCoreComponent()
        {
            base.AddCoreComponent();

            Platform = Add<PlatformSystem>();
            File = Add<FileSystem>();
            Res = Add<ResSystem>();
            Table = Add<TableSystem>();
            Audio = Add<AudioSystem>();

            // Variant = Add<VariantSystem>();

            Timer = Add<TimerSystem>();
            Setting = Add<SettingSystem>();

            UI = Add<UISystem, bool>(true);
        }
    }
}
